package com.ghpt.controller;

import com.ghpt.pojo.Result;
import com.ghpt.pojo.Reliability;
import com.ghpt.service.ReliabilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/reliability")
public class ReliabilityController {
    @Autowired
    private ReliabilityService reliabilityService;
    @PutMapping("/insert/{method}/{num}")
    public Result insert(@PathVariable int method, @PathVariable int num)
    {
        Reliability reliability = new Reliability(null, method, num);
        int result = reliabilityService.insert(reliability);
        if (result > 0)
        {
            return Result.success();
        }
        else
        {
            return Result.error("提交失败");
        }
    }
}